﻿@{
    ViewBag.Title = "AddUnit";
    Layout = "~/Views/Shared/_Admin.cshtml";
}
<div class="main-content" style="margin-left: 190px; min-height: 575px;">
    <div class="breadcrumbs" id="breadcrumbs">
        <ul class="breadcrumb">
            <li><i class="icon-home home-icon"></i><a href="/admin/index">Dashboard</a> </li>
            <li><a href="javascript:;">楼栋管理</a></li>
            <li class="active">添加销售单元</li>
        </ul>
        <!-- .breadcrumb -->
    </div>
    <div class="page-content">
        <div class="row-fluid">
            <div class="span7">
                <h3 class="row-fluid header smaller lighter purple">
                    <span class="span12">新添加销售单元</span>
                    <!-- /span -->
                </h3>
                <div class="span12">
                    <form class="form-horizontal" action="/admin/addunit" method="post">
                        <div class="control-group">
                            <label class="control-label" for="inputEmail">销售单元名称</label>
                            <div class="controls">
                              <input type="text" class="input-xlarge" 
                                 name="SalesUnitName" placeholder="销售单元名称" />
                            </div>
                         </div>
                         <div class="control-group">
                            <label class="control-label" for="inputEmail">销售单元负责人</label>
                            <div class="controls">
                              <select name="LinkMan">
                                @{
                                    List<CollegeShop.Infrastructure.Entities.Entity.User> staff = ViewBag.Staff;
                                    if(staff != null && staff.Any())
                                    {
                                        foreach(var item in staff)
                                        {
                                            <option value="@item.UserName">@item.RealName</option>
                                        }
                                    }
                                }
                              </select>
                            </div>
                         </div>
                         <div class="control-group">
                            <label class="control-label" for="inputEmail">联系人电话</label>
                            <div class="controls">
                              <input type="text" class="input-xlarge" 
                                 name="LinkPhone" placeholder="联系人电话" />
                            </div>
                         </div>
                         <div class="form-actions">
                            <button class="btn btn-primary" type="submit">
								<i class="icon-ok bigger-110"></i>
								完成
							</button>
                            <button class="btn" type="reset">
							    <i class="icon-undo bigger-110"></i>
							    重置
						    </button>
                         </div>
                    </form>
                </div>
            </div>
            <div class="span5">
                <h3 class="row-fluid header smaller lighter purple">
                    <span class="span12">销售单元</span>
                </h3>
                <div class="span12">
                @{
                    List<CollegeShop.Infrastructure.Entities.Entity.Salesunit> list = ViewBag.Unit;
                    if (list != null && list.Count > 0)
                    {
                        @:<ol class="dd-list">
                        foreach (var item in list)
                        {
                            <li class="dd-item dd2-item">
                                <div class="dd-handle dd2-handle">
                                    <i class="normal-icon icon-angle-right orange bigger-130"></i><i class="drag-icon icon-move bigger-125">
                                    </i>
                                </div>
                                <div class="dd2-content">
                                    @item.SalesUnitName</div>
                                    @if(item.Dormitories != null && item.Dormitories.Any())
                                    {
                                        <ol class="dd-list">
                                        @foreach(var ditem in item.Dormitories)
                                        {
                                            <li class="dd-item dd2-item">
                                                <div class="dd-handle dd2-handle">
                                                    <i class="normal-icon icon-angle-right green bigger-130"></i><i class="drag-icon icon-move bigger-125">
                                                    </i>
                                                </div>
                                                <div class="dd2-content">
                                                    @ditem.DormitoryName</div>
                                            </li>
                                        }
                                        </ol>
                                    }
                            </li>
                        }
                        @:</ol>
                    }
                    else
                    {
                        <ol class="dd-list">
                            <li class="dd-item dd2-item">
                                <div class="dd-handle dd2-handle">
                                    <i class="normal-icon icon-angle-right pink bigger-130"></i><i class="drag-icon icon-move bigger-125">
                                    </i>
                                </div>
                                <div class="dd2-content">
                                    暂无销售单元</div>
                            </li>
                        </ol>
                    }
                }
                </div>
            </div>
        </div>
    </div>
</div>
@section tail{
    <script type="text/javascript">
        $(function () {
            $('#domitoryBlock').trigger('click');
        });
    </script>
}
